package com.littlepay.kr4.paulin.dfeba77;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;

import com.littlepay.kr4.paulin.dfeba77.fragment.SettingFragment;

/**
 * Created by john on 2017/5/15.
 */

public class SettingActivity extends AppCompatActivity {
    Toolbar toolbar;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       // String budget_value =  PrefUtils.getBudget();
        setContentView(R.layout.activity_setting);

        //Intent intent = new Intent(this,PushService.class);
        //startService(intent);

        //TextView widget_text = (TextView) LayoutInflater.from(SettingActivity.this).inflate(R.layout.textview_layout,null).findViewById(R.id.widget_text);
        getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingFragment()).commit();
        toolbar = (Toolbar) findViewById(R.id.toolbar_preference);
        setSupportActionBar(toolbar);
        if(getSupportActionBar() != null){
            getSupportActionBar().setHomeButtonEnabled(true);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setDisplayShowTitleEnabled(false);
        }
        //设置监听返回

//        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()){
            case android.R.id.home:
                finish();
                break;
        }
        return false;
    }



//        widget_text.setText("ok");


        //getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingFragment()).commit();

}
